import Vue from 'vue';
import store from '../../portal/store';

import {
  getStandards,
  getOneStandard,
} from './api';

const Bus = new Vue({
  store,
});

export default {
  standards: () => ({
    autoGet: false,
    GetData: (q) => getStandards(q).then((d) => {
      const data = (d && d.data) || {};

      return data;
    }),
    Bus,
  }),
  standardDetails: (route) => ({
    GetData: () => getOneStandard(route.params.id).then((d) => {
      const data = (d && d.data) || {};

      return data;
    }),
    Bus,
  }),
};
